
<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link rel="shortcut icon" href="images/favicon.ico">
    <link rel="apple-touch-icon-precomposed" href="images/apple-touch-icon.png">
	<title>${cache.conf.name!'八一学院'}</title>
	<link rel="stylesheet" href="${root}css/seedsui.min.css">
    <style>
    .group{
        padding: 0 12px;
    }
    .icon.active{
        color: #20aeff;
    }
    .scrollpicker{
    bottom: 258px;
    }
    </style>
</head>

<body ontouchstart="" style="background-color: white;">
	<header>
	    <div class="titlebar reverse">
	        <a class="titlebar-button" href="${root}">
                <img width="24px;" style="border-radius: 40px;" height="24px;" src="${root}img/logo.png" />
            </a>
	        <h1 class="titlebar-title text-center">用户注册</h1>
	        <a href="${root}login" class="titlebar-button SID-BtnSubmit"><span>登录</span></a>
	    </div>
	</header>
	<article >
	<div style="text-align: center;">
	<img class="slide-banner" style="height: 150px;width: 150px;" src="${root}img/logo.png">
	<h1>心课堂（IEPSY.COM）</h1>
	</div><br/>
	<form id="form1" action="${root}users/reg" method="post">
	<input type="hidden" name=".table" value="users" />
            <div class="group">
                <div class="inputbox underline">
                    <label class="inputbox-left">手机号</label>
                    <div class="inputbox-right inputbox" data-input="reveal">
                        <input type="text" class="input-text" placeholder="手机号" id="phone" name="phone"/>
                        <i class="icon icon-rdoclose-fill color-placeholder" style="font-size: 20px;line-height: 24px;text-align: center;display: none;"></i>
                    </div>
                </div>
                <div class="inputbox underline">
                    <label class="inputbox-left">验证码</label>
                    <div class="inputbox-right inputbox">
                        <input type="text" id="smscode" class="input-text" name="smscode">
                    </div>
                    <input id="codetxt" type="button" class="button" value="发送验证码" style="padding: 0 10px;height: 32px;border-radius: 4px;width: 92px;">
                </div>
            </div>
           
        <div style="line-height: 50px;padding: 8px 16px 16px 0px;">
                <a id="sub" class="button block submit" style="margin:8px;border-radius: 4px;width: 100%;">
                    <span>注册</span>
                </a>
                
        </div>
        </form>
        
	</article>
	<script src="${root}js/jquery-2.1.3.js"></script>
    <script src="${root}js/seedsui.min.js"></script>
    
	<script>
	var count=60;
	var jishu=null;
	var smcode="";
	$(function(){
		$("#codetxt").click(function(){
			if(!(/^1[1-9][0-9]\d{8}$/.test($("#phone").val()))){
				alert("手机号码格式错误");
				return;
			}
			$(this).attr("disabled",true)
			jishu=window.setInterval(sum,1000);
			$.ajax({
				async:false,
			     type: 'POST',
			     url: '${root}raw/sms/reg' ,
			    data: {phone:$("#phone").val()} ,
			    success: function(data){
			    	smcode=data;
			    },
			    dataType: 'text'
			});
		})
		$("#sub").click(function(){
			if($("#phone").val()==""){
				alert("手机号不能为空");
				return;
			}else if($("#smscode").val()==""){
				alert("手机号不能为空");
				return;
			}else if($("#smscode").val()!=smcode){
				alert("验证码不正确!");
				return;
			}else{
				$("#form1").submit();
			}
		})
	})
	function sum(){
		if(count>0){
		$("#codetxt").val(count+"秒")
		count--;
		}else{
			$("#codetxt").removeAttr("disabled")
			$("#codetxt").val("发送验证码")
			count=60;
			window.clearInterval(jishu);
		}
	}
	</script>
</body>
</html>
